<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!-- This file documents the GNU Assembler "as".

Copyright (C) 1991-2016 Free Software Foundation, Inc.

Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3
or any later version published by the Free Software Foundation;
with no Invariant Sections, with no Front-Cover Texts, and with no
Back-Cover Texts.  A copy of the license is included in the
section entitled "GNU Free Documentation License".
 -->
<!-- Created by GNU Texinfo 5.2, http://www.gnu.org/software/texinfo/ -->
<head>
<title>Using as: ARM Directives</title>

<meta name="description" content="Using as: ARM Directives">
<meta name="keywords" content="Using as: ARM Directives">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="index.html#Top" rel="start" title="Top">
<link href="AS-Index.html#AS-Index" rel="index" title="AS Index">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="ARM_002dDependent.html#ARM_002dDependent" rel="up" title="ARM-Dependent">
<link href="ARM-Opcodes.html#ARM-Opcodes" rel="next" title="ARM Opcodes">
<link href="ARM-Floating-Point.html#ARM-Floating-Point" rel="prev" title="ARM Floating Point">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.smallquotation {font-size: smaller}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.indentedblock {margin-left: 3.2em}
div.lisp {margin-left: 3.2em}
div.smalldisplay {margin-left: 3.2em}
div.smallexample {margin-left: 3.2em}
div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
div.smalllisp {margin-left: 3.2em}
kbd {font-style:oblique}
pre.display {font-family: inherit}
pre.format {font-family: inherit}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: inherit; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: inherit; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.nocodebreak {white-space:nowrap}
span.nolinebreak {white-space:nowrap}
span.roman {font-family:serif; font-weight:normal}
span.sansserif {font-family:sans-serif; font-weight:normal}
ul.no-bullet {list-style: none}
-->
</style>


</head>

<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
<a name="ARM-Directives"></a>
<div class="header">
<p>
Next: <a href="ARM-Opcodes.html#ARM-Opcodes" accesskey="n" rel="next">ARM Opcodes</a>, Previous: <a href="ARM-Floating-Point.html#ARM-Floating-Point" accesskey="p" rel="prev">ARM Floating Point</a>, Up: <a href="ARM_002dDependent.html#ARM_002dDependent" accesskey="u" rel="up">ARM-Dependent</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="AS-Index.html#AS-Index" title="Index" rel="index">Index</a>]</p>
</div>
<hr>
<a name="ARM-Machine-Directives"></a>
<h4 class="subsection">9.4.4 ARM Machine Directives</h4>

<a name="index-machine-directives_002c-ARM"></a>
<a name="index-ARM-machine-directives"></a>
<dl compact="compact">
<dd>

<a name="index-_002e2byte-directive_002c-ARM"></a>
<a name="index-_002e4byte-directive_002c-ARM"></a>
<a name="index-_002e8byte-directive_002c-ARM"></a>
</dd>
<dt><code>.2byte <var>expression</var> [, <var>expression</var>]*</code></dt>
<dt><code>.4byte <var>expression</var> [, <var>expression</var>]*</code></dt>
<dt><code>.8byte <var>expression</var> [, <var>expression</var>]*</code></dt>
<dd><p>These directives write 2, 4 or 8 byte values to the output section.
</p>
<a name="index-_002ealign-directive_002c-ARM"></a>
</dd>
<dt><code>.align <var>expression</var> [, <var>expression</var>]</code></dt>
<dd><p>This is the generic <var>.align</var> directive.  For the ARM however if the
first argument is zero (ie no alignment is needed) the assembler will
behave as if the argument had been 2 (ie pad to the next four byte
boundary).  This is for compatibility with ARM&rsquo;s own assembler.
</p>
<a name="index-_002earch-directive_002c-ARM"></a>
</dd>
<dt><code>.arch <var>name</var></code></dt>
<dd><p>Select the target architecture.  Valid values for <var>name</var> are the same as
for the <samp>-march</samp> commandline option.
</p>
<p>Specifying <code>.arch</code> clears any previously selected architecture
extensions.
</p>
<a name="index-_002earch_005fextension-directive_002c-ARM"></a>
</dd>
<dt><code>.arch_extension <var>name</var></code></dt>
<dd><p>Add or remove an architecture extension to the target architecture.  Valid
values for <var>name</var> are the same as those accepted as architectural
extensions by the <samp>-mcpu</samp> commandline option.
</p>
<p><code>.arch_extension</code> may be used multiple times to add or remove extensions
incrementally to the architecture being compiled for.
</p>
<a name="index-_002earm-directive_002c-ARM"></a>
</dd>
<dt><code>.arm</code></dt>
<dd><p>This performs the same action as <var>.code 32</var>.
</p>

<a name="index-_002ebss-directive_002c-ARM"></a>
</dd>
<dt><code>.bss</code></dt>
<dd><p>This directive switches to the <code>.bss</code> section.
</p>

<a name="index-_002ecantunwind-directive_002c-ARM"></a>
</dd>
<dt><code>.cantunwind</code></dt>
<dd><p>Prevents unwinding through the current function.  No personality routine
or exception table data is required or permitted.
</p>
<a name="index-_002ecode-directive_002c-ARM"></a>
</dd>
<dt><code>.code <code>[16|32]</code></code></dt>
<dd><p>This directive selects the instruction set being generated. The value 16
selects Thumb, with the value 32 selecting ARM.
</p>
<a name="index-_002ecpu-directive_002c-ARM"></a>
</dd>
<dt><code>.cpu <var>name</var></code></dt>
<dd><p>Select the target processor.  Valid values for <var>name</var> are the same as
for the <samp>-mcpu</samp> commandline option.
</p>
<p>Specifying <code>.cpu</code> clears any previously selected architecture
extensions.
</p>

<a name="index-_002edn-and-_002eqn-directives_002c-ARM"></a>
</dd>
<dt><code><var>name</var> .dn <var>register name</var> [<var>.type</var>] [[<var>index</var>]]</code></dt>
<dt><code><var>name</var> .qn <var>register name</var> [<var>.type</var>] [[<var>index</var>]]</code></dt>
<dd>
<p>The <code>dn</code> and <code>qn</code> directives are used to create typed
and/or indexed register aliases for use in Advanced SIMD Extension
(Neon) instructions.  The former should be used to create aliases
of double-precision registers, and the latter to create aliases of
quad-precision registers.
</p>
<p>If these directives are used to create typed aliases, those aliases can
be used in Neon instructions instead of writing types after the mnemonic
or after each operand.  For example:
</p>
<div class="smallexample">
<pre class="smallexample">        x .dn d2.f32
        y .dn d3.f32
        z .dn d4.f32[1]
        vmul x,y,z
</pre></div>

<p>This is equivalent to writing the following:
</p>
<div class="smallexample">
<pre class="smallexample">        vmul.f32 d2,d3,d4[1]
</pre></div>

<p>Aliases created using <code>dn</code> or <code>qn</code> can be destroyed using
<code>unreq</code>.
</p>

<a name="index-_002eeabi_005fattribute-directive_002c-ARM"></a>
</dd>
<dt><code>.eabi_attribute <var>tag</var>, <var>value</var></code></dt>
<dd><p>Set the EABI object attribute <var>tag</var> to <var>value</var>.
</p>
<p>The <var>tag</var> is either an attribute number, or one of the following:
<code>Tag_CPU_raw_name</code>, <code>Tag_CPU_name</code>, <code>Tag_CPU_arch</code>,
<code>Tag_CPU_arch_profile</code>, <code>Tag_ARM_ISA_use</code>,
<code>Tag_THUMB_ISA_use</code>, <code>Tag_FP_arch</code>, <code>Tag_WMMX_arch</code>,
<code>Tag_Advanced_SIMD_arch</code>, <code>Tag_PCS_config</code>,
<code>Tag_ABI_PCS_R9_use</code>, <code>Tag_ABI_PCS_RW_data</code>,
<code>Tag_ABI_PCS_RO_data</code>, <code>Tag_ABI_PCS_GOT_use</code>,
<code>Tag_ABI_PCS_wchar_t</code>, <code>Tag_ABI_FP_rounding</code>,
<code>Tag_ABI_FP_denormal</code>, <code>Tag_ABI_FP_exceptions</code>,
<code>Tag_ABI_FP_user_exceptions</code>, <code>Tag_ABI_FP_number_model</code>,
<code>Tag_ABI_align_needed</code>, <code>Tag_ABI_align_preserved</code>,
<code>Tag_ABI_enum_size</code>, <code>Tag_ABI_HardFP_use</code>,
<code>Tag_ABI_VFP_args</code>, <code>Tag_ABI_WMMX_args</code>,
<code>Tag_ABI_optimization_goals</code>, <code>Tag_ABI_FP_optimization_goals</code>,
<code>Tag_compatibility</code>, <code>Tag_CPU_unaligned_access</code>,
<code>Tag_FP_HP_extension</code>, <code>Tag_ABI_FP_16bit_format</code>,
<code>Tag_MPextension_use</code>, <code>Tag_DIV_use</code>,
<code>Tag_nodefaults</code>, <code>Tag_also_compatible_with</code>,
<code>Tag_conformance</code>, <code>Tag_T2EE_use</code>,
<code>Tag_Virtualization_use</code>
</p>
<p>The <var>value</var> is either a <code>number</code>, <code>&quot;string&quot;</code>, or
<code>number, &quot;string&quot;</code> depending on the tag.
</p>
<p>Note - the following legacy values are also accepted by <var>tag</var>:
<code>Tag_VFP_arch</code>, <code>Tag_ABI_align8_needed</code>,
<code>Tag_ABI_align8_preserved</code>, <code>Tag_VFP_HP_extension</code>,
</p>
<a name="index-_002eeven-directive_002c-ARM"></a>
</dd>
<dt><code>.even</code></dt>
<dd><p>This directive aligns to an even-numbered address.
</p>
<a name="index-_002eextend-directive_002c-ARM"></a>
<a name="index-_002eldouble-directive_002c-ARM"></a>
</dd>
<dt><code>.extend  <var>expression</var> [, <var>expression</var>]*</code></dt>
<dt><code>.ldouble  <var>expression</var> [, <var>expression</var>]*</code></dt>
<dd><p>These directives write 12byte long double floating-point values to the
output section.  These are not compatible with current ARM processors
or ABIs.
</p>

<a name="arm_005ffnend"></a><a name="index-_002efnend-directive_002c-ARM"></a>
</dd>
<dt><code>.fnend</code></dt>
<dd><p>Marks the end of a function with an unwind table entry.  The unwind index
table entry is created when this directive is processed.
</p>
<p>If no personality routine has been specified then standard personality
routine 0 or 1 will be used, depending on the number of unwind opcodes
required.
</p>
<a name="arm_005ffnstart"></a><a name="index-_002efnstart-directive_002c-ARM"></a>
</dd>
<dt><code>.fnstart</code></dt>
<dd><p>Marks the start of a function with an unwind table entry.
</p>
<a name="index-_002eforce_005fthumb-directive_002c-ARM"></a>
</dd>
<dt><code>.force_thumb</code></dt>
<dd><p>This directive forces the selection of Thumb instructions, even if the
target processor does not support those instructions
</p>
<a name="index-_002efpu-directive_002c-ARM"></a>
</dd>
<dt><code>.fpu <var>name</var></code></dt>
<dd><p>Select the floating-point unit to assemble for.  Valid values for <var>name</var>
are the same as for the <samp>-mfpu</samp> commandline option.
</p>

<a name="index-_002ehandlerdata-directive_002c-ARM"></a>
</dd>
<dt><code>.handlerdata</code></dt>
<dd><p>Marks the end of the current function, and the start of the exception table
entry for that function.  Anything between this directive and the
<code>.fnend</code> directive will be added to the exception table entry.
</p>
<p>Must be preceded by a <code>.personality</code> or <code>.personalityindex</code>
directive.
</p>

<a name="index-_002einst-directive_002c-ARM"></a>
</dd>
<dt><code>.inst <var>opcode</var> [ , &hellip; ]</code></dt>
<dt><code>.inst.n <var>opcode</var> [ , &hellip; ]</code></dt>
<dt><code>.inst.w <var>opcode</var> [ , &hellip; ]</code></dt>
<dd><p>Generates the instruction corresponding to the numerical value <var>opcode</var>.
<code>.inst.n</code> and <code>.inst.w</code> allow the Thumb instruction size to be
specified explicitly, overriding the normal encoding rules.
</p>

</dd>
<dt><code>.ldouble  <var>expression</var> [, <var>expression</var>]*</code></dt>
<dd><p>See <code>.extend</code>.
</p>
<a name="index-_002eltorg-directive_002c-ARM"></a>
</dd>
<dt><code>.ltorg</code></dt>
<dd><p>This directive causes the current contents of the literal pool to be
dumped into the current section (which is assumed to be the .text
section) at the current location (aligned to a word boundary).
<code>GAS</code> maintains a separate literal pool for each section and each
sub-section.  The <code>.ltorg</code> directive will only affect the literal
pool of the current section and sub-section.  At the end of assembly
all remaining, un-empty literal pools will automatically be dumped.
</p>
<p>Note - older versions of <code>GAS</code> would dump the current literal
pool any time a section change occurred.  This is no longer done, since
it prevents accurate control of the placement of literal pools.
</p>

<a name="index-_002emovsp-directive_002c-ARM"></a>
</dd>
<dt><code>.movsp <var>reg</var> [, #<var>offset</var>]</code></dt>
<dd><p>Tell the unwinder that <var>reg</var> contains an offset from the current
stack pointer.  If <var>offset</var> is not specified then it is assumed to be
zero.
</p>

<a name="index-_002eobject_005farch-directive_002c-ARM"></a>
</dd>
<dt><code>.object_arch <var>name</var></code></dt>
<dd><p>Override the architecture recorded in the EABI object attribute section.
Valid values for <var>name</var> are the same as for the <code>.arch</code> directive.
Typically this is useful when code uses runtime detection of CPU features.
</p>

<a name="index-_002epacked-directive_002c-ARM"></a>
</dd>
<dt><code>.packed  <var>expression</var> [, <var>expression</var>]*</code></dt>
<dd><p>This directive writes 12-byte packed floating-point values to the
output section.  These are not compatible with current ARM processors
or ABIs.
</p>
<a name="arm_005fpad"></a><a name="index-_002epad-directive_002c-ARM"></a>
</dd>
<dt><code>.pad #<var>count</var></code></dt>
<dd><p>Generate unwinder annotations for a stack adjustment of <var>count</var> bytes.
A positive value indicates the function prologue allocated stack space by
decrementing the stack pointer.
</p>
<a name="index-_002epersonality-directive_002c-ARM"></a>
</dd>
<dt><code>.personality <var>name</var></code></dt>
<dd><p>Sets the personality routine for the current function to <var>name</var>.
</p>
<a name="index-_002epersonalityindex-directive_002c-ARM"></a>
</dd>
<dt><code>.personalityindex <var>index</var></code></dt>
<dd><p>Sets the personality routine for the current function to the EABI standard
routine number <var>index</var>
</p>
<a name="index-_002epool-directive_002c-ARM"></a>
</dd>
<dt><code>.pool</code></dt>
<dd><p>This is a synonym for .ltorg.
</p>

<a name="index-_002ereq-directive_002c-ARM"></a>
</dd>
<dt><code><var>name</var> .req <var>register name</var></code></dt>
<dd><p>This creates an alias for <var>register name</var> called <var>name</var>.  For
example:
</p>
<div class="smallexample">
<pre class="smallexample">        foo .req r0
</pre></div>


<a name="arm_005fsave"></a><a name="index-_002esave-directive_002c-ARM"></a>
</dd>
<dt><code>.save <var>reglist</var></code></dt>
<dd><p>Generate unwinder annotations to restore the registers in <var>reglist</var>.
The format of <var>reglist</var> is the same as the corresponding store-multiple
instruction.
</p>
<div class="smallexample">
<pre class="smallexample"><em>core registers</em>
</pre><pre class="smallexample">  .save {r4, r5, r6, lr}
  stmfd sp!, {r4, r5, r6, lr}
</pre><pre class="smallexample"><em>FPA registers</em>
</pre><pre class="smallexample">  .save f4, 2
  sfmfd f4, 2, [sp]!
</pre><pre class="smallexample"><em>VFP registers</em>
</pre><pre class="smallexample">  .save {d8, d9, d10}
  fstmdx sp!, {d8, d9, d10}
</pre><pre class="smallexample"><em>iWMMXt registers</em>
</pre><pre class="smallexample">  .save {wr10, wr11}
  wstrd wr11, [sp, #-8]!
  wstrd wr10, [sp, #-8]!
or
  .save wr11
  wstrd wr11, [sp, #-8]!
  .save wr10
  wstrd wr10, [sp, #-8]!
</pre></div>

<a name="arm_005fsetfp"></a><a name="index-_002esetfp-directive_002c-ARM"></a>
</dd>
<dt><code>.setfp <var>fpreg</var>, <var>spreg</var> [, #<var>offset</var>]</code></dt>
<dd><p>Make all unwinder annotations relative to a frame pointer.  Without this
the unwinder will use offsets from the stack pointer.
</p>
<p>The syntax of this directive is the same as the <code>add</code> or <code>mov</code>
instruction used to set the frame pointer.  <var>spreg</var> must be either
<code>sp</code> or mentioned in a previous <code>.movsp</code> directive.
</p>
<div class="smallexample">
<pre class="smallexample">.movsp ip
mov ip, sp
&hellip;
.setfp fp, ip, #4
add fp, ip, #4
</pre></div>

<a name="index-_002esecrel32-directive_002c-ARM"></a>
</dd>
<dt><code>.secrel32 <var>expression</var> [, <var>expression</var>]*</code></dt>
<dd><p>This directive emits relocations that evaluate to the section-relative
offset of each expression&rsquo;s symbol.  This directive is only supported
for PE targets.
</p>
<a name="index-_002esyntax-directive_002c-ARM"></a>
</dd>
<dt><code>.syntax [<code>unified</code> | <code>divided</code>]</code></dt>
<dd><p>This directive sets the Instruction Set Syntax as described in the
<a href="ARM_002dInstruction_002dSet.html#ARM_002dInstruction_002dSet">ARM-Instruction-Set</a> section.
</p>

<a name="index-_002ethumb-directive_002c-ARM"></a>
</dd>
<dt><code>.thumb</code></dt>
<dd><p>This performs the same action as <var>.code 16</var>.
</p>
<a name="index-_002ethumb_005ffunc-directive_002c-ARM"></a>
</dd>
<dt><code>.thumb_func</code></dt>
<dd><p>This directive specifies that the following symbol is the name of a
Thumb encoded function.  This information is necessary in order to allow
the assembler and linker to generate correct code for interworking
between Arm and Thumb instructions and should be used even if
interworking is not going to be performed.  The presence of this
directive also implies <code>.thumb</code>
</p>
<p>This directive is not neccessary when generating EABI objects.  On these
targets the encoding is implicit when generating Thumb code.
</p>
<a name="index-_002ethumb_005fset-directive_002c-ARM"></a>
</dd>
<dt><code>.thumb_set</code></dt>
<dd><p>This performs the equivalent of a <code>.set</code> directive in that it
creates a symbol which is an alias for another symbol (possibly not yet
defined).  This directive also has the added property in that it marks
the aliased symbol as being a thumb function entry point, in the same
way that the <code>.thumb_func</code> directive does.
</p>
<a name="index-_002etlsdescseq-directive_002c-ARM"></a>
</dd>
<dt><code>.tlsdescseq <var>tls-variable</var></code></dt>
<dd><p>This directive is used to annotate parts of an inlined TLS descriptor
trampoline.  Normally the trampoline is provided by the linker, and
this directive is not needed.
</p>

<a name="index-_002eunreq-directive_002c-ARM"></a>
</dd>
<dt><code>.unreq <var>alias-name</var></code></dt>
<dd><p>This undefines a register alias which was previously defined using the
<code>req</code>, <code>dn</code> or <code>qn</code> directives.  For example:
</p>
<div class="smallexample">
<pre class="smallexample">        foo .req r0
        .unreq foo
</pre></div>

<p>An error occurs if the name is undefined.  Note - this pseudo op can
be used to delete builtin in register name aliases (eg &rsquo;r0&rsquo;).  This
should only be done if it is really necessary.
</p>
<a name="index-_002eunwind_005fraw-directive_002c-ARM"></a>
</dd>
<dt><code>.unwind_raw <var>offset</var>, <var>byte1</var>, &hellip;</code></dt>
<dd><p>Insert one of more arbitary unwind opcode bytes, which are known to adjust
the stack pointer by <var>offset</var> bytes.
</p>
<p>For example <code>.unwind_raw 4, 0xb1, 0x01</code> is equivalent to
<code>.save {r0}</code>
</p>

<a name="index-_002evsave-directive_002c-ARM"></a>
</dd>
<dt><code>.vsave <var>vfp-reglist</var></code></dt>
<dd><p>Generate unwinder annotations to restore the VFP registers in <var>vfp-reglist</var>
using FLDMD.  Also works for VFPv3 registers
that are to be restored using VLDM.
The format of <var>vfp-reglist</var> is the same as the corresponding store-multiple
instruction.
</p>
<div class="smallexample">
<pre class="smallexample"><em>VFP registers</em>
</pre><pre class="smallexample">  .vsave {d8, d9, d10}
  fstmdd sp!, {d8, d9, d10}
</pre><pre class="smallexample"><em>VFPv3 registers</em>
</pre><pre class="smallexample">  .vsave {d15, d16, d17}
  vstm sp!, {d15, d16, d17}
</pre></div>

<p>Since FLDMX and FSTMX are now deprecated, this directive should be
used in favour of <code>.save</code> for saving VFP registers for ARMv6 and above.
</p>

</dd>
</dl>

<hr>
<div class="header">
<p>
Next: <a href="ARM-Opcodes.html#ARM-Opcodes" accesskey="n" rel="next">ARM Opcodes</a>, Previous: <a href="ARM-Floating-Point.html#ARM-Floating-Point" accesskey="p" rel="prev">ARM Floating Point</a>, Up: <a href="ARM_002dDependent.html#ARM_002dDependent" accesskey="u" rel="up">ARM-Dependent</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="AS-Index.html#AS-Index" title="Index" rel="index">Index</a>]</p>
</div>



</body>
</html>
